export default {
	state: {
		homeCurent:0,
		windowSize: {
			x: 0,
			y: 0,
			isMobile: false,
			isResize: false
		},
	},
	mutations: { //必须同步执行，可以直接操作State
		mut_layout(state, {
			x,
			y,
			isResize
		}) {
			// 移动端判断
			let userAgentInfo = navigator.userAgent,
				Agents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod'],
				getArr = Agents.filter(i => userAgentInfo.includes(i));
			console.warn('移动端判断：'+(getArr.length ? true : false));
			state.windowSize = {
				x,
				y,
				isMobile: getArr.length ? true : false,
				isResize
			};
		},
		mut_setHomeCurent(state, val) {
		    console.log(val);
		    // 本地缓存
		    localStorage.setItem("homeCurent", val);
		    state.homeCurent = val;
		},
	},
	actions: { //可以异步，但不能直接操作State
		// 初始化获取首页点击导航栏index本地缓存
		act_initHomeCurent({
			state,
			commit
		}) {
			console.log('初始化获取首页点击导航栏index本地缓存');
			// 初始化获取本地缓存
			let homeCurent = localStorage.getItem("homeCurent");
			commit('mut_setHomeCurent', homeCurent);
		}
	}
}